﻿<!DOCTYPE html>

<!--学习列表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
</head>

<body>
    
<div id="app" v-cloak>   
            <el-row>
        
        <el-col span="24">
            <el-form label-position=" right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                style="margin-bottom: 15px;">
                <el-row>
                    <el-col class="head-tool">
                            
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />在线学习列表</strong></div>
                        <span>
                            <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3"
                                @click="onSubmit">
                            </btn>
                            <btn-export-list url="/api/PX_Course/ExportForQBKC" :forminline="this.formInline" linetype="4"></btn-export-list>
                        </span>
                    </el-col>
                </el-row>
                <el-row>
                    <list-factorys v-model="formInline.model.createFactory" @change="factoryChange"></list-factorys>
                    <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input v-model="formInline.model.coursewareName" :placeholder="OnlineLearning.Nameofdata"
                                          size="mini">
                                    <template slot="prepend">
                                        {{OnlineLearning.Nameofdata+mark.m}}
                                    </template>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-row>
            </el-form>
            <el-col span="6">
                    <!-- <h3 style="margin-top:0;font-size:14px;">资料分类</h3> -->
                <div class="tree_lay">
                    <h4 class="title clearfix"><strong>课程分类</strong></h4>
                    <el-tree :data="TreeData" :props="defaultProps" @node-click="handleNodeClick">
                        <span slot-scope="scope">
                            <span>
                                <i :class="scope.data.icon"></i>
                                <template>
                                    <span v-if="scope.data.icon == 'tree-open'"
                                          style="color:#12489e">{{ scope.node.label }}</span>
                                    <span v-else-if="scope.data.icon == 'tree-close'"
                                          style="color: #12489e">{{ scope.node.label }}</span>
                                    <span v-else>{{ scope.node.label }}</span>
                                </template>
                            </span>
                        </span>
                    </el-tree>
                </div>
                </el-col>
            <el-col span="18">
            <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
                @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;height: 100%;">
                <el-table-column type="selection" style="
        padding-top: 0px;
        padding-bottom: 0px;
    " align="center" width="55" :reserve-selection="true">
                </el-table-column>
                <!-- 除第一列以外 遍历所有字段 -->
                <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  下同-->
               
                <el-table-column prop="coursewareName" :label="OnlineLearning.Nameofdata" min-width="250"
                    show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="mark03" min-width="250" :label="OnlineLearning.Dataclassification" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column  min-width="150" prop="mark01" :label="OnlineLearning.Founder" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column min-width="150" prop="createTime" :label="OnlineLearning.Creationtime" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column width="53" :label="col.btndetails" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.mark02)>
                            <i class="el-icon-tickets"></i>
                        </button>
                    </template>
                </el-table-column>
            </el-table>
            <el-row type="flex" justify="end">

                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                    :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                    :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
        </el-col>

            <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
            <el-dialog title="在线学习" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                top="10vh" fullscreen="true">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
            </el-dialog>
        </el-col>

    </el-row>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                TreeData: [],
                mydata: treeOnlineLearningCategoryData,

                defaultProps: {
                    children: 'children',
                    label: 'label'
                },

                ListItem: ListItem,
                sqldata: treeOnlineLearningCategoryData,
                treeOnlineLearningCategoryData: [],
                value1: '',
                Certificatetype: [],
                checked: true,
                isShow: true,
                formInline: {
                    model: {
                        PersonnelName: '',
                        Subordinatedepartments: '',
                        Nameofcertificate: '',
                        Issuancetime: '',
                        Maturitytime: '',
                        Certificatetype: '',
                        LicenseCoding: '',
                        Licensingauthority: '',
                        Termofvalidity: '',
                        describe: '',
                        TreeNode: ''
                    },
                    offset: 0,
                    limit: 10
                },
            },
            mounted: function () {

                
                //列表高度自适应
                tablehigh(this);
               
            },
            methods: {
                factoryChange: function () {
                    var mythis = this;
                    this.GetPageData(1);
                    //myAjax("post", this, '/api/PX_Questions/GetTree', this.formInline, function (response) {
                    //    mythis.TreeData = fn(response.data, "00000000-0000-0000-0000-000000000000");
                    //    mythis.TreeData.unshift({ id: null, label: '全部', Id: null })//初始化无父级的选项
                    //}, false);

                    myAjax("post", this, '/api/PX_CourseClass/GetList', this.formInline, function (response) {

                        var data = MenuHelper(response.data.pageData, guidEmpty);
                        mythis.TreeData = data;
                        mythis.TreeData.unshift({ id: null, label: '全部', Id: null })
                        // mythis.DepartmentList.unshift({ id: guidEmpty, label: '无父级', Id: guidEmpty })//初始化无父级的选项
                    }, false);

                },

                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                handleNodeClick: function (data) {
                    if (!data.children) {
                        this.formInline.model.classificationofCourseware = data.id
                        onSubmit(this);
                    } else {
                        if (data.icon == "tree-open") {
                            data.icon = "tree-close"
                        } else (
                            data.icon = "tree-open"
                        )
                    }
                },
                //关闭Dialog 回调
                closeDialog: function () { closeDialog(this); },
                //Model 替换成 表名
                onDelete: function () { onDelete(this, '/api/OnlineLearning/DeleteMuti'); },

                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Model 替换成 表名
                UserInput: function (val, id) {
                    this.ListItem.InputUrl = id;
                    this.ListItem.dialogVisible = true;
                },

                //Model 替换成 表名
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PX_Course/QBKC') },

                onSubmit: function () { onSubmit(this); },

                handleSizeChange: function (val) { handleSizeChange(this, val); },

                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

            }
        });

        function MenuHelper(list, pid) {
            var result = [];
            list.forEach(function (v, i) {
                if (v.pId == pid) {
                    var obj = v;
                    obj.id = obj.id + '';
                    obj.label = obj.name + '';
                    obj.icon = 'tree-item';
                    var nextObj = MenuHelper(list, v.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                        obj.icon = 'tree-open';
                    }
                }
                if (obj)
                    result.push(obj)
            })

            
            return result;
        }
    </script>

</body>

</html>